<!DOCTYPE html
	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title> 商品添加 </title>
	<base href="__STATIC__/">
	<link href="styles/general.css" rel="stylesheet" type="text/css" />
	<link href="styles/main.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="js/utils.js"></script>
	<script type="text/javascript" src="js/selectzone.js"></script>
	<script type="text/javascript" src="js/colorselector.js"></script>
	<script type="text/javascript" src="js/calendar.php?lang="></script>
</head>

<body>
	<h1>
		<span class="action-span"><a href="goods.php?act=list">商品列表</a></span>
		<span class="action-span1"><a href="index.php?act=main">SHOP 管理中心 </a> </span><span id="search_id"
			class="action-span1"> - 编辑商品信息 </span>
		<div style="clear:both"></div>
	</h1>

	<div class="tab-div">
		<!-- tab bar -->
		<div id="tabbar-div">
			<p>
				<span class="tab-front" id="general-tab">通用信息</span>
			</p>
		</div>

		<!-- tab body -->
		<div id="tabbody-div">
			<form action="{:url('goods/add')}" method="post" name="theForm">

				<!-- 通用信息 -->
				<table width="90%" id="general-table" align="center" style="display: table;">
					<tbody>
						<tr>
							<td class="label">商品名称：</td>
							<td><input type="text" name="goods_name" value="诺基亚N85" size="30"><span
									class="require-field">*</span></td>
						</tr>
						<tr>
							<td class="label">商品货号： </td>
							<td><input type="text" name="goods_code" value="ECS000032" size="20"><span
									class="require-field">*</span><br>
								<span class="notice-span" style="display:block"
									id="noticeGoodsSN">如果您不输入商品货号，系统将自动生成一个唯一的货号。</span></td>
						</tr>
						<tr>
							<td class="label">商品分类：</td>
							<td>
								<select name="category_id">
									<option value="0">请选择...</option>
									<option value="1">手机类型</option>
									<option value="5">&nbsp;&nbsp;&nbsp;&nbsp;双模手机</option>
									<option value="2">&nbsp;&nbsp;&nbsp;&nbsp;CDMA手机</option>
									<option value="3" selected="ture">&nbsp;&nbsp;&nbsp;&nbsp;GSM手机</option>
									<option value="4">&nbsp;&nbsp;&nbsp;&nbsp;3G手机</option>
									<option value="12">充值卡</option>
									<option value="15">&nbsp;&nbsp;&nbsp;&nbsp;联通手机充值卡</option>
									<option value="13">&nbsp;&nbsp;&nbsp;&nbsp;小灵通/固话充值卡</option>
									<option value="14">&nbsp;&nbsp;&nbsp;&nbsp;移动手机充值卡</option>
									<option value="6">手机配件</option>
									<option value="8">&nbsp;&nbsp;&nbsp;&nbsp;耳机</option>
									<option value="9">&nbsp;&nbsp;&nbsp;&nbsp;电池</option>
									<option value="11">&nbsp;&nbsp;&nbsp;&nbsp;读卡器和内存卡</option>
									<option value="7">&nbsp;&nbsp;&nbsp;&nbsp;充电器</option>
								</select>
							</td>
						</tr>
						<tr>
							<td class="label">商品品牌：</td>
							<td>
								<select name="type_id" id="goods_type">
									{foreach $data as $v}
										<option value="{$v.type_id}">{$v.type_name}</option>
									{/foreach}
									
									<!-- <option value="1" selected="">诺基亚</option>
									<option value="10">金立</option>
									<option value="9">联想</option>
									<option value="8">LG</option>
									<option value="7">索爱</option>
									<option value="6">三星</option>
									<option value="5">夏新</option>
									<option value="4">飞利浦</option>
									<option value="3">多普达</option>
									<option value="2">摩托罗拉</option>
									<option value="11"> 恒基伟业</option> -->
								</select>
							</td>
						</tr>
						<tr>
							<td class="label">商品类型：</td>
							<td>
								<select name="type_id" id="goods_type">
									<option value="0">请选择商品类型</option>
									<option value="1">书</option>
									<option value="2">音乐</option>
									<option value="3">电影</option>
									<option value="4">手机</option>
									<option value="5">笔记本电脑</option>
									<option value="6">数码相机</option>
									<option value="7">数码摄像机</option>
									<option value="8">化妆品</option>
									<option value="9">精品手机</option>
									<option value="10">我的商品</option>

								</select><br>
								<span class="notice-span" style="display:block"
									id="noticeGoodsType">请选择商品的所属类型，进而完善此商品的属性</span>
							</td>
						</tr>

					</tbody>
					<tbody id="type_attr">

						<tr>
							<td class="label"><a href="javascript:;" class="addRow">[ + ]</a>&nbsp;&nbsp;颜色：</td>
							<td><input type="text" name="" value=""></td>
						</tr>
						<tr>
							<td class="label"><a href="javascript:;" class="addRow">[ - ]</a>&nbsp;&nbsp;颜色：</td>
							<td><input type="text" name="" value=""></td>
						</tr>
						<tr>
							<td class="label"><a href="javascript:;" class="addRow">[ + ]</a>&nbsp;&nbsp;内存：</td>
							<td><input type="text" name="" value=""></td>
						</tr>
						<tr>
							<td class="label"><a href="javascript:;" class="addRow">[ - ]</a>&nbsp;&nbsp;内存：</td>
							<td><input type="text" name="" value=""></td>
						</tr>
						<tr>
							<td class="label"><a href="javascript:;" class="addRow">[ + ]</a>&nbsp;&nbsp;运行内存：</td>
							<td><input type="text" name="" value=""></td>
						</tr>
						<tr>
							<td class="label"><a href="javascript:;" class="addRow">[ - ]</a>&nbsp;&nbsp;运行内存：</td>
							<td><input type="text" name="" value=""></td>
						</tr>
					</tbody>

				</table>


				<div class="button-div">
					<input type="hidden" value="" id="attr_ids" name="attr_ids">
					<input type="submit" value=" 确定 " class="button">
					<input type="reset" value=" 重置 " class="button">
				</div>
			</form>
		</div>
	</div>


	<div id="footer">
		版权所有 &copy; 2006-2013
	</div>
	<script type="text/javascript" src="js/tab.js"></script>
	<script type="text/javascript">
		function addImg(obj) {
			var src = obj.parentNode.parentNode;
			var idx = rowindex(src);
			var tbl = document.getElementById('gallery-table');
			var row = tbl.insertRow(idx + 1);
			var cell = row.insertCell(-1);
			cell.innerHTML = src.cells[0].innerHTML.replace(/(.*)(addImg)(.*)(\[)(\+)/i, "$1removeImg$3$4-");
		}

		function removeImg(obj) {
			var row = rowindex(obj.parentNode.parentNode);
			var tbl = document.getElementById('gallery-table');
			tbl.deleteRow(row);
		}

		function dropImg(imgId) {
			Ajax.call('goods.php?is_ajax=1&act=drop_image', "img_id=" + imgId, dropImgResponse, "GET", "JSON");
		}

		function dropImgResponse(result) {
			if (result.error == 0) {
				document.getElementById('gallery_' + result.content).style.display = 'none';
			}
		}
	</script>

	</script>
<script src="js/jquery-3.3.1.js"></script>
	<script>
	$(document).on('change','#goods_type',function(){
		var type_id = $(this).val();
		$.ajax({
			url:"{:url('Attr/getAttrByTypeId')}",
			type:"post",
			data:{type_type:type_id},
			dataType:"json",
			success:function(res)
			{
				var str = '';
				$(res.data).each(function(k,v){
					str +='<td class="label"><a href="javascript:;" class="addRow">[ + ]</a>&nbsp;&nbsp;'+v.attr_name+'：</td><td><input type="text" name="attr_'+v.attr+'[]" value=""></td>'
				})
				$("#type_attr").empty();
				$("#type_attr").append(str);

			}
		})
	})
	</script>
</body>

</html>